#!/usr/bin/env python
# -*- coding:UTF-8 -*-
__author__ = 'wycao'

import os
import json
from pgre.postgkeyword import PostKeyword

pk = PostKeyword()
fileurl = os.getcwd() +'/stock_6.json'
with open(fileurl,'r') as f:
    fjson = json.loads(f.read())
    stockList = fjson['stockList']
    for s in range(len(stockList)):
        values = []
        category = stockList[s]['category']
        code = stockList[s]['code']
        orgid = stockList[s]['orgId']
        shortname = stockList[s]['zwjc']
        values.append(orgid)
        values.append(category)
        values.append(code)
        values.append(shortname)
        pk.insert_stock_info(values)

